const path = require('path');
const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');

module.exports = function(env = {}, argv) {
    const plugins = [];

    const isProduction = env['production']

    if (isProduction) {
        plugins.push(
            new UglifyJsPlugin()
        )
    }

    return {
        plugins: plugins,
        devtool: isProduction ? undefined : 'source-map'
    }
}